<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>更新邮件</title>


<link rel="stylesheet" href="$!{__beat.server.contextPath}/css/theme/font-awesome.min.css" type="text/css" />		
<link rel="stylesheet" href="$!{__beat.server.contextPath}/css/theme/bootstrap.min.css" type="text/css" />	
<link rel="stylesheet" href="$!{__beat.server.contextPath}/javascript/theme/libs/jquery-easyui-1.4/themes/default/easyui.css" type="text/css" />		
<link rel="stylesheet" href="$!{__beat.server.contextPath}/css/theme/App.css" type="text/css" />
<link rel="stylesheet" href="$!{__beat.server.contextPath}/css/theme/custom.css" type="text/css" />
<script src="$!{__beat.server.contextPath}/javascript/theme/libs/jquery-1.9.1.min.js"></script>
<script src="$!{__beat.server.contextPath}/javascript/theme/libs/jquery-easyui-1.4/jquery.easyui.min.js"></script>
<script src="$!{__beat.server.contextPath}/javascript/theme/libs/bootstrap.min.js"></script>
<script src="$!{__beat.server.contextPath}/javascript/theme/App.js"></script>
<script type="text/javascript" src="$!{__beat.server.contextPath}/javascript/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="$!{__beat.server.contextPath}/javascript/iemail.js"></script>

<style type="text/css">
.table1 {
	border: 1px solid rgb(153, 187, 232);width:100%;
}
.table_head {
	background: #B0C9E7; height: 25px; text-align: left; line-height: 25px; text-indent: 20px; font-weight: bolder;
}
.table_con {
	background: rgb(223, 232, 246);
}
.table_in {
	background: rgb(208, 208, 208); border: 0px currentColor; margin-top: 5px; margin-bottom: 5px;border-collapse: separate;border-spacing: 2px;
}
.table_in th {
	background: #F0F1F3; height: 22px; border-bottom-color: rgb(208, 208, 208); border-bottom-width: 1px; border-bottom-style: solid; text-align:center;
}
.table_in .td1 {i
	background: #F0F1F3; height: 22px; text-align: center;border-bottom-color: rgb(208, 208, 208); border-bottom-width: 1px; border-bottom-style: solid; text-align:center;
}
.table_in td {
	height: 22px; text-align: right; line-height: 22px; border-bottom-color: rgb(237, 237, 237); border-bottom-width: 1px; border-bottom-style: solid;text-align:center;
}
.tdbg10 {
	background: rgb(238, 239, 241);
}
.tdbg11 {
	background: rgb(255, 255, 255);
}

</style>
</head>
<body>
<div id="content" style="OVERFLOW-X:yes;OVERFLOW-Y:auto">		
		
	<div id="content-container">
		
		<form class="form-horizontal" role="form" id="setEmailContent" name="setEmailContent" action="$!{__beat.server.contextPath}/intemail/addNewEmail " method="post" onsubmit="return subCheck();">
    		<input type="hidden" id="state" name="state" value="$!{mainVo.state}"/>
			<input type="hidden" id="dbTemplate" name="dbTemplate" value="$!{dbTemplate}"/>
			<div class="portlet">
    			
    				<div class="portlet-header">
    					<h3>
    						<i class="fa fa-tasks"></i>
    						邮件基本信息
    					</h3>
    			
    				</div> <!-- /.portlet-header -->
    			
    		
                	<div class="portlet-content">
    					<div class="form-group">
							<label class="col-md-2">邮件名称：</label>
							<div class="col-md-2">
								<input style="width:360px" type="text" title="邮件名称" id="baseMainInfo" name="baseMainInfo" value="$!{mainVo.emailName}" class="form-control"/>
							</div>
    							
    						<label class="col-md-2">邮件所属类别：</label>
        					<div class="col-md-2">
    							<input style="width:360px" type="text" title="邮件所属类别"  id="baseMainInfo" name="baseMainInfo" value="$!{mainVo.emailCate}" class="form-control"/>
        					</div>
    								
    						##<button type="button" id="subMail" name ="subMail" class="btn btn-primary btn-xs">确认订阅</button>
						</div>
					
						</br>
    					<div class="form-group">
    						<label class="col-md-2">收件人列表（邮箱以英文分号;间隔）：</label>
        					<div class="col-md-2">
        						<input style="width:680px"type="text" title="收件人列表" id="baseSendInfo" name="baseSendInfo" value="$!{sendVo.emailAds}" class="form-control"/>
        					</div>
    								
        				</div>
						
						</br>
    					<div class="form-group">
    						<label class="col-md-2">邮件内容描述：</label>
        					<div class="col-md-2">
        						<input style="width:815px"type="text" id="baseMainInfo" name="baseMainInfo"  value="$!{mainVo.description}" class="form-control"/>
        					</div>
    								
        				</div>
    							
						</br>
    					<div class="form-group">
							<input type="hidden" id="sendFreValue"  title="发送频率" name="sendFreValue" value="$!{sendVo.sendFre}"/>
    						<label class="col-md-2">发送频率</label>
    						<div class="col-md-2">
        						<input type="radio" name="sendFreRadio" id="sendFreRadio" #if($!{sendVo.sendFre} == 'day' ) checked #end onclick="sendFre('day')"/> 每日
        						<input type="radio" name="sendFreRadio" id="sendFreRadio" #if($!{sendVo.sendFre} == 'week' ) checked #end onclick="sendFre('week')"/> 每周1
								<input type="radio" name="sendFreRadio" id="sendFreRadio" #if($!{sendVo.sendFre} != 'day' && $!{sendVo.sendFre} != 'week') checked #end onclick="sendFre('self')"/> 自定义
    						</div>
        					<div class="col-md-2" id="userDefinedFre">
        						<input type="text"  alias="freValue"  id="baseSendInfo" name="baseSendInfo"  #if($!{sendVo.sendFre} != 'day' && $!{sendVo.sendFre} != 'week') value="$!{sendVo.sendFre}"  #else readonly="true" #end class="form-control"/>
        					</div>
							<label class="col-md-2" style="color:red">(周1-周日分别为1-7,中间以英文分号;隔开)</label>
							<label class="col-md-2">发送时间</label>
							<div class="col-md-2">
        						<input  type="text"  title="发送时间"  id="baseSendInfo" name="baseSendInfo" style="width:120px;height:25px" class="Wdate form-control"  value="$!{sendVo.sendTime}"  onclick="WdatePicker({skin:'ext',dateFmt:'HH:mm:ss'})"/>
        					</div>


        				</div>
						 </br>
                        <div class="form-group">
                            <label class="col-md-2">阈值1</label>
                            <div class="col-md-2">
                                <input  style="width:60px" type="text" title="阈值1" id="baseSendInfo" name="baseSendInfo"  value="$!{sendVo.threshold0}" class="form-control"/>
                            </div>
                            <label class="col-md-2">阈值2</label>
                            <div class="col-md-2">
                                <input  style="width:45px" type="text" title="阈值2" id="baseSendInfo" name="baseSendInfo"  value="$!{sendVo.threshold}" class="form-control"/>
                            </div>

                            <label class="col-md-2">预警短信</label>
                            <div class="col-md-2">
                                <input type="text"  style="width:90px" title="预警短信" id="baseSendInfo" name="baseSendInfo"  value="$!{sendVo.warnTel}" class="form-control"/>
                            </div>
                            <label class="col-md-2">预警邮件收件人(英文分号;间隔):</label>
                            <div class="col-md-2">
                                <input style="width:400px"type="text" title=">预警邮件收件人" id="baseSendInfo" name="baseSendInfo" value="$!{sendVo.warnMail}" class="form-control"/>
                            </div>

                        </div>
	
        			</div>
                   
    			
			</div> <!-- /.portlet -->

    		<div class="portlet">
    			
    				<div class="portlet-header">
    					<h3>
    						<i class="fa fa-tasks"></i>
    						邮件内容配置
    					</h3>
    			
    				</div> <!-- /.portlet-header -->
					
					<input type="hidden" id="tableCount" name="tableCount" value="$!{tableList.size()}"/>
    		
                	<div id="toAddEmailTem" class="portlet-content">
						
    					<div class="form-group">
							<label class="col-md-2">表格模板类型：</label>
							<div class="col-md-2">
								<select size="1"  style="height:28px; width:130px;"  class="form-control" name="tableTempType" id="tableTempType" onchange="templateChange()">
									#foreach( $template in $templateList)
                                        <option value="$!{template.id}" >$!{template.name}</option>
									#end
                                </select>
							</div>
							
							<label class="col-md-2">表格大小：</label>
							<div class="col-md-2" id="tableRowDiv">
								<input style="width:55px"type="text" id="tableRow" name="tableRow"  value="$!{tableRow}" class="form-control"/>行数
							</div>
							<div class="col-md-2" id="tableX" >
								X
							</div>
							<div class="col-md-2" id="tableColDiv" >
								<input style="width:55px"type="text" id="tableCol" name="tableCol"  value="$!{tableCol}" class="form-control"/>列数
							</div>
							<div class="col-md-2" id="tableRowDiv2" >
                                <input style="width:55px" type="text" id="tableRow2" name="tableRow2"  value="$!{tableRow2}" class="form-control"/>分行数
                            </div>
							<div class="col-md-2" id="tableColDiv2" >
								<input style="width:55px" type="text" id="tableCol2" name="tableCol2"  value="$!{tableCol2}" class="form-control"/>分列/行数
							</div>
							
    						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    						<button type="button" id="addNewTable" name ="addNewTable" class="btn btn-primary btn-xs">新增表格</button>
    						<input type="button"  id="updateEmail" name ="updateEmail" style="float:right" class="btn btn-primary btn-xs" value="更新邮件"/>		
							<input type="hidden" id="updateMainId" name="updateMainId" value="$!{mainVo.Id}"/>
						</div>
						<BR>
						
						##邮件内容区域
						<div id="tabs" class="easyui-tabs" data-options="tabWidth:112">
						#foreach($table in $tableList)
							<div id="table$velocityCount" title="table$velocityCount" closable="true"> 
							<div id="" class="portlet-content " style="OVERFLOW-X:yes;OVERFLOW-Y:auto">
								#set($tableCount = $velocityCount)
								
    							<input type="hidden" id="thisTableCount" name="thisTableCount" value="$tableCount"/>
    							<input type="hidden" id="templateType$tableCount" name="templateType$tableCount" value="$!{table.templateType}"/>
    							<input type="hidden" id="dataOrder$tableCount" name="dataOrder$tableCount" value="$!{table.dataOrder}"/>
    							<input type="button" class="btn btn-primary btn-xs" onclick="addNewRow(this,'$!{table.templateType}')" value="新增行"/>
    							&nbsp;&nbsp;&nbsp;&nbsp;
        						#set($thTwoList = $table.templateThTwo.split(','))
								#if($!{table.templateType} == 1)
									<input type="button" class="btn btn-primary btn-xs" onclick="addNewCol(this)" value="新增指标列"/>
								#end
								#if($!{table.templateType} == 3)
									<input type="button" class="btn btn-primary btn-xs" onclick="addNewCol2(this)" value="新增指标列"/>
    							#end
    							#if($!{table.templateType} == 4)
									<input type="button" class="btn btn-primary btn-xs" onclick="addNewCol3(this)" value="新增列"/>
									&nbsp;&nbsp;&nbsp;&nbsp;
									<input type="button" class="btn btn-primary btn-xs" onclick="addNewCol2(this)" value="新增分列"/>
								#elseif($!{table.templateType} == 5)
									<input type="button" class="btn btn-primary btn-xs" onclick="addNewRow2(this,5)" value="新增单行"/>
									&nbsp;&nbsp;&nbsp;&nbsp;
									<input type="button" class="btn btn-primary btn-xs" onclick="addNewCol(this)" value="新增列"/>
                                #elseif($!{table.templateType} == 6)
                                    <input type="button" class="btn btn-primary btn-xs" onclick="addNewRow2(this,'5')" value="新增单行"/>
                                    &nbsp;&nbsp;&nbsp;&nbsp;
                                    <input type="button" class="btn btn-primary btn-xs" onclick="addNewCol3(this)" value="新增列"/>
                                    &nbsp;&nbsp;&nbsp;&nbsp;
                                    <input type="button" class="btn btn-primary btn-xs" onclick="addNewCol2(this)" value="新增分列"/>
                                #end
    						&nbsp;&nbsp;&nbsp;&nbsp;							
							<input type="button" class="btn btn-primary btn-xs" onclick="addComment(this,'$!{table.templateType}')" value="新增注释行"/>
    							<table id="" width="96%"  cellpadding="0" cellspacing="0" class="table1" style="OVERFLOW-X:yes;OVERFLOW-Y:auto">
                            	   <tr>
                                        <td class="editable simpleInput table_head" style="color:red" id="tableName" name="tableName" value = "$!{table.tableName}">
    										$!{table.tableName}
    									</td>
                                   </tr>
								   
                            	   <tr>
                                    <td class="table_con" valign="top">
                                    	#set($spanNum = $!tools.getStrArrLen($table.templateThTwo,","))
                                    	<input type="hidden" id="spanNum" name="spanNum" value="$!spanNum"/>
										<table id="emailContentTable" width="99%" align="center" cellpadding="0" cellspacing="1" class="table_in" style="OVERFLOW-X:yes;OVERFLOW-Y:auto">
										##表格内容区域
										#if($!{table.templateType} == 1)  ## 模板1
                                				##th
    											<tr>
        											#set($thList = $table.templateTh.split(','))
        											#foreach($th in $thList )
    													 #if($velocityCount == 1)
    														<th id="templateTh$tableCount" name="templateTh$tableCount" class="editable simpleInput">$th</th>
    													 #elseif($th == '日比')
    														<th id="templateTh$tableCount" name="templateTh$tableCount" class="editable simpleInput" >日比&nbsp;&nbsp;<a style='color:#6C6C6C' href='javascript:void(0)' onclick='deleteCol(this,1)'>删除</a></th>
    													 #elseif($th == '周比')
    														<th id="templateTh$tableCount" name="templateTh$tableCount"class="editable simpleInput" >周比&nbsp;&nbsp;<a style='color:#6C6C6C' href='javascript:void(0)' onclick='deleteCol(this,1)'>删除</a></th>
    													 #else 
    														<th id="templateTh$tableCount" name="templateTh$tableCount" class="editable simpleInput" style="color:red">$th&nbsp;&nbsp;<a style='color:#6C6C6C' href='javascript:void(0)' onclick='deleteCol(this,1)'>删除</a></th>
    													 #end
        												 
        											#end
                                				</tr>
        										##th end
        										
    											##tds
    											
    											#set($tdAll = $table.templateTd.split(';'))
    											#foreach($tdTemp in $tdAll)
    												#set($tdList = $tdTemp.split(','))
            										<tr onMouseOver="this.className='tdbg10'" onMouseOut="this.className='tdbg11'" class="tdbg11">
        											   #foreach($td in $tdList)
    														#if($velocityCount == 1)
    															<td id="templateTd$tableCount" name="templateTd$tableCount" class="td1 editable simpleInput" style="color:red">$td&nbsp;&nbsp;<a style='color:#6C6C6C' href='javascript:void(0)' onclick='deleteRow(this,1)'>删除</a></td>
    														#elseif($td == 'null')
    															<td id="templateTd$tableCount" name="templateTd$tableCount" class="editable simpleInput" ></td>
    														#else
    															<td id="templateTd$tableCount" name="templateTd$tableCount" class="editable simpleInput" style="color:red">$td</td>
    														#end
        											   #end
                                    				
                                                    </tr>
    											#end
    											##tds-end
										#elseif($!{table.templateType} == 2)  ##模板2
												<tr>
                                					<th id="templateTh$tableCount" name="templateTh$tableCount">指标</th>
        											<th id="templateTh$tableCount" name="templateTh$tableCount">今日&nbsp;&nbsp;</th>
        											<th id="templateTh$tableCount" name="templateTh$tableCount">昨日&nbsp;&nbsp;</th>
        											<th id="templateTh$tableCount" name="templateTh$tableCount">日比&nbsp;&nbsp;</th>
        											<th id="templateTh$tableCount" name="templateTh$tableCount">上周&nbsp;&nbsp;</th>
        											<th id="templateTh$tableCount" name="templateTh$tableCount">周比&nbsp;&nbsp;</th>
												</tr>
										
												#set($tdAll = $table.templateTd.split(';'))
        										#foreach($tdTemp in $tdAll)
            										<tr onMouseOver="this.className='tdbg10'" onMouseOut="this.className='tdbg11'" class="tdbg11">
													   #set($indexValue = $tdTemp.split(',')[0].trim())
                                    				   <td id="templateTd$tableCount" name="templateTd$tableCount" class="td1 editable simpleInput" style="color:red">
														$indexValue &nbsp;&nbsp;<a style='color:#6C6C6C' href='javascript:void(0)' onclick='deleteRow(this,2)'>删除</a>
													   </td>
                                                       <td id="templateTd$tableCount" name="templateTd$tableCount"></td>
                                        			   <td id="templateTd$tableCount" name="templateTd$tableCount"></td>
                                        			   <td id="templateTd$tableCount" name="templateTd$tableCount"></td>
        											   <td id="templateTd$tableCount" name="templateTd$tableCount"></td>
                                        			   <td id="templateTd$tableCount" name="templateTd$tableCount"></td>
                                                    </tr>
        										#end
										
										#elseif($!{table.templateType} == 3 || $!{table.templateType} == 4)  ## 模板3
                                				##th
    											<tr>
    											#if($!{table.templateType} == 3)
        											#set($thList = $table.templateTh.split(',',2))
        										#else
        											#set($thList = $table.templateTh.split(','))
        										#end
        											#foreach($th in $thList )
        												#if($velocityCount == 1)
        											 		<th id="templateTh#tableCount" rowspan="2" name="templateTh#tableCount" class="editable simpleInput">$th</th>
    													#else
    														#set($tmp = $velocityCount - 2)
    														<th id="templateTh$tableCount" colspan="$colSpan.get($tableCount).get($tmp)"
    														 name="templateTh$tableCount" class="editable simpleInput" style="color:red">$th #if($!{table.templateType} == 4)&nbsp;&nbsp;<a style="color:#6C6C6C" href="javascript:void(0)" onclick="deleteCol3(this)">删除</a></th>
    														#end
        												#end
        											#end
                                				</tr>
                                				<tr>
                        							#foreach($thTwo in $thTwoList)
                            							<th class="editable simpleInput" style="color:red">$thTwo&nbsp;&nbsp;<a style='color:#6C6C6C' href='javascript:void(0)' onclick='deleteCol2(this)'>删除</a></th>
    												#end
    											</tr>
                                				
        										##th end
        										
    											##tds
    											
    											#set($tdAll = $table.templateTd.split(';'))
    											#foreach($tdTemp in $tdAll)
    												#set($tdList = $tdTemp.split(','))
            										<tr onMouseOver="this.className='tdbg10'" onMouseOut="this.className='tdbg11'" class="tdbg11">
        											   #foreach($td in $tdList)
    														#if($velocityCount == 1)
    															<td id="templateTd$tableCount" name="templateTd$tableCount" class="td1 editable simpleInput" style="color:red">$td&nbsp;&nbsp;<a style='color:#6C6C6C' href='javascript:void(0)' onclick="deleteRow(this,$!{table.templateType})">删除</a></td>
    														#elseif($td == 'null')
    															<td id="templateTd$tableCount" name="templateTd$tableCount" class="editable simpleInput" ></td>
    														#else
    															<td id="templateTd$tableCount" name="templateTd$tableCount" class="editable simpleInput" style="color:red">$td</td>
    														#end
        											   #end
                                    				
                                                    </tr>
    											#end
    											##tds-end
										#elseif($!{table.templateType} == 5)  ## 模板5
                                				##th
    											<tr>
        											#set($thList = $table.templateTh.split(','))
        											#foreach($th in $thList )
        												#if($velocityCount == 1)
        											 		<th id="templateTh#tableCount" colspan="2" name="templateTh#tableCount" class="editable simpleInput">$th</th>
    													#else
    														#set($tmp = $velocityCount - 2)
    														<th id="templateTh$tableCount" name="templateTh$tableCount" class="editable simpleInput" style="color:red">$th&nbsp;&nbsp;<a style='color:#6C6C6C' href='javascript:void(0)' onclick='deleteCol(this,5)'>删除</a></th>
        												#end
        											#end
                                				</tr>
                                				
        										##th end
        										
    											##tds
    											
    											#set($tdAll = $table.templateTd.split(';'))
    											#set($rowNum = 1)
    											#set($counter = 0)
    											#foreach($tdTemp in $tdAll)
    												#set($tdList = $tdTemp.split(','))
    												#set($n = $velocityCount)
            										<tr onMouseOver="this.className='tdbg10'" onMouseOut="this.className='tdbg11'" class="tdbg11">
        											   #foreach($td in $tdList)
        											   		#if($td == 'null')
    															<td id="templateTd$tableCount" name="templateTd$tableCount" class="editable simpleInput" style="color:red"></td>
    														#elseif($n == $rowNum)
    															#if($velocityCount == 1)
    																<td id="templateTd$tableCount" rowspan="$colSpan.get($tableCount).get($counter)" name="templateTd$tableCount" class="td1 editable simpleInput" style="color:red">$td</td>
    															#elseif($velocityCount == 2)
    																<td id="templateTd$tableCount" name="templateTd$tableCount" class="td1 editable simpleInput" style="color:red">$td&nbsp;&nbsp;<a style='color:#6C6C6C' href='javascript:void(0)' onclick="deleteRow(this,$!{table.templateType})">删除</a></td>
    															#else
    																<td id="templateTd$tableCount" name="templateTd$tableCount" class="editable simpleInput" style="color:red">$td</td>
    															#end
    														#elseif($velocityCount == 1)
    															<td id="templateTd$tableCount" name="templateTd$tableCount" class="td1 editable simpleInput" style="color:red">$td&nbsp;&nbsp;<a style='color:#6C6C6C' href='javascript:void(0)' onclick="deleteRow(this,$!{table.templateType})">删除</a></td>
    														#else
    															<td id="templateTd$tableCount" name="templateTd$tableCount" class="editable simpleInput" style="color:red">$td</td>
    														#end
        											   #end
                                                    </tr>
                                                    #if($rowNum == $velocityCount)
    													#set($rowNum = $rowNum + $colSpan.get($tableCount).get($counter))
    													#set($counter = $counter + 1)
    												#end
    											#end
    											##tds-end

                                        #elseif($!{table.templateType} == 6)  ## 模板6
                                                ##th
                                                <tr>
                                                    #set($thList = $table.templateTh.split(','))
                                                    #foreach($th in $thList )
                                                        #if($velocityCount == 1)
                                                            <th id="templateTh#tableCount" rowspan="2" colspan="2" name="templateTh#tableCount" class="editable simpleInput">$th</th>
                                                        #else
                                                            #set($tmp = $velocityCount - 2)
                                                            <th id="templateTh$tableCount" colspan="$colSpan.get($tableCount).get($tmp)"
                                                             name="templateTh$tableCount" class="editable simpleInput" style="color:red">$th&nbsp;&nbsp;<a style="color:#6C6C6C" href="javascript:void(0)" onclick="deleteCol3(this)">删除</a></th>
                                                        #end
                                                    #end
                                                </tr>

                                                <tr>
                                                    #foreach($thTwo in $thTwoList)
                                                        <th class="editable simpleInput" style="color:red">$thTwo&nbsp;&nbsp;<a style='color:#6C6C6C' href='javascript:void(0)' onclick='deleteCol2(this)'>删除</a></th>
                                                    #end
                                                </tr>

                                                ##th end
                                                
                                                ##tds
                                                
                                                #set($tdAll = $table.templateTd.split(';'))
                                                #set($rowNum = 1)
                                                #set($counter = 0)
                                                #foreach($tdTemp in $tdAll)
                                                    #set($tdList = $tdTemp.split(','))
                                                    #set($n = $velocityCount)
                                                    <tr onMouseOver="this.className='tdbg10'" onMouseOut="this.className='tdbg11'" class="tdbg11">
                                                       #foreach($td in $tdList)
                                                            #if($td == 'null')
                                                                <td id="templateTd$tableCount" name="templateTd$tableCount" class="editable simpleInput" style="color:red"></td>
                                                            #elseif($n == $rowNum)
                                                                #if($velocityCount == 1)
                                                                    <td id="templateTd$tableCount" rowspan="$rowSpan.get($tableCount).get($counter)" name="templateTd$tableCount" class="td1 editable simpleInput" style="color:red">$td</td>
                                                                #elseif($velocityCount == 2)
                                                                    <td id="templateTd$tableCount" name="templateTd$tableCount" class="td1 editable simpleInput" style="color:red">$td&nbsp;&nbsp;<a style='color:#6C6C6C' href='javascript:void(0)' onclick="deleteRow(this,$!{table.templateType})">删除</a></td>
                                                                #else
                                                                    <td id="templateTd$tableCount" name="templateTd$tableCount" class="editable simpleInput" style="color:red">$td</td>
                                                                #end
                                                            #elseif($velocityCount == 1)
                                                                <td id="templateTd$tableCount" name="templateTd$tableCount" class="td1 editable simpleInput" style="color:red">$td&nbsp;&nbsp;<a style='color:#6C6C6C' href='javascript:void(0)' onclick="deleteRow(this,$!{table.templateType})">删除</a></td>
                                                            #else
                                                                <td id="templateTd$tableCount" name="templateTd$tableCount" class="editable simpleInput" style="color:red">$td</td>
                                                            #end
                                                       #end
                                                    </tr>
                                                    #if($rowNum == $velocityCount)
                                                        #set($rowNum = $rowNum + $rowSpan.get($tableCount).get($counter))
                                                        #set($counter = $counter + 1)
                                                    #end
                                                #end
                                                ##tds-end

                                               

                                                
    									#end
										</table>
										##end
                                    </td>
                                   </tr>
                                   #if("$!table.tableComment" != "")
                                   <tr onMouseOver="this.className='tdbg10'" onMouseOut="this.className='tdbg11'" class="tdbg11">
                                   		<td id='tableComment' name='tableComment' class='td1 editable simpleInput' style="color:red">
                                   		$!table.tableComment<a style='color:#6C6C6C' href='javascript:void(0)' onclick='delComment(this)' >删除</a>
                                   		</td>
                                   </tr>
                                   #end
                           		 </table>
    						 
    							 </br>
    							 
								 
								 ##指标SQL区域
								 
								 <div>
    								 #set($tableSearchList = $tableSearchMap.get($table.id))
    								 
    								 #foreach($tableSearch in $tableSearchList)
                                     <div  id='sqlconf'>
                                        <br>
    									<div class="form-group">
                                                <label class="col-md-2" style='color:red'>指标集:</label>
                                                <div class="col-md-2" style="width:80%">                                                
                    						      <input style='width:100%'type='text' id='templateIndex$tableCount'  name ='templateIndex$tableCount' class='form-control' value="$!{tableSearch.indexs}"/>
                                                </div>
                                              
                                                  <input  type='button' class="col-md-2" style='float:right'  onclick='dropThisSql(this)' value='删除该数据源配置'/>

                                         </div>
                                        <div class="form-group" style='margin-top:10px'>
                                            <label class="col-md-2" >对应数据库:</label>
                							<div class="col-md-2"  style="width:30%">
                								<select size='1' style='width:100%;height:25px'  id='templateDB$tableCount'  name ='templateDB$tableCount' value="$!{tableSearch.dbId}">
                                            		   #foreach($db in $dbList)
                                            			<option value='${db.ename}:${db.id}:${db.host}'  #if($!{tableSearch.dbId} == $!{db.id} ) selected #end >
                                        						${db.cname}(${db.ename})
                                        				</option>
                                        			   #end
                                                </select>
                                            </div>

                                             <label class="col-md-2" >表名:</label>
                                            <div class="col-md-2" style="width:27%">
                                                <input  style="width:100%;" type="text" id="srcTable$tableCount" name="srcTable$tableCount" class="form-control" value="$!{tableSearch.srcTable}"/>
                                            </div>
                                            <label class="col-md-2" >是否校验:</label>
                                            <div class="col-md-2" style="width:6%">
                                                <select style='width:100%;height:25px'  id='checkTable$tableCount'  name ='checkTable$tableCount'>
                                                    <option value='0'  #if($!{tableSearch.isCheck} == 0 ) selected #end >否</option>
                                                    <option value='1'  #if($!{tableSearch.isCheck} == 1 ) selected #end >是</option>
                                                </select>
                                            </div>
                                            <label class="col-md-2" >日期字段:</label>
                                            <div class="col-md-2" style="width:8%">
                                                 <input  style="width:100%;" type="text" id="dateField$tableCount" name="dateField$tableCount" class="form-control" value="$!{tableSearch.dateField}"/>
                                            </div>
                						</div>	    
                                        <div class="form-group">	
                							<label class="col-md-2" >SQL1:</label>
                                            <div class="col-md-2" style="width:100%">
                                                <textarea style="font-family:'Microsoft YaHei'; font-size:14px; line-height:20px; height:70px; width:100%"   id='templateSql$tableCount'  name ='templateSql$tableCount'>$!{tableSearch.searchSql}</textarea>
                                            </div>
        				                </div>
                                        <br>
                                      </div>
    								 #end
    								  ##指标SQL区域  - end
        							<input id="" type="button"   style="float:right"  class="btn btn-primary btn-xs" onclick="addNewSql(this)" value="新增数据源sql"/>
				                 </div>
    							
     						</div> <!-- /.portlet-content -->
     						</div> <!-- /#id="tablei" -->
						#end
						
						</div>	<!-- /#id="tabs" -->
        			</div>
                   
    			
			</div> <!-- /.portlet -->

		</form>
	</div> <!-- /#content-container -->
	
	
</div> <!-- #content -->
	
<script >
	initBindGridEvent();
</script>

</body>
</html>